<template>
	<view class="">
		<!-- {{type==1?'村规明月传的':'通知公告穿的'}}这个页面穿的{{type}}
		详情应该是富文本 -->
		<jyf-parser :html="content" ref="article" :tag-style="tagStyle"></jyf-parser>

	</view>
</template>

<script>
	import {
		newsgetH5Detail,
		rulegetH5Detail
	} from "@/api/togeterRich/family.js"
	import parser from "@/components/jyf-parser/jyf-parser";
	export default {
		components: {

			"jyf-parser": parser
		},
		data() {
			return {
				id: '',
				type: null,
				content: ''

			}
		},
		onLoad(e) {
			this.id = e.id
			this.type = e.type
			if (this.type == 1) {
				uni.setNavigationBarTitle({
					title: '村规民约详情'
				});
			} else if (this.type == 2) {
				uni.setNavigationBarTitle({
					title: '通知公告详情'
				});
			}
			this.init()

		},

		methods: {
			init() {
				if (this.type == 1) {
					let data = {
						id: this.id
					}
					rulegetH5Detail(data).then(res => {

						this.content = res.data.content
					})
				} else if (this.type == 2) {
					this.initList()
					uni.setNavigationBarTitle({
						title: '通知公告'
					});
				}

			},
			initList() {
				let data = {
					id: this.id
				}
				newsgetH5Detail(data).then(res => {
					this.content = res.data.content
					// console.log(res, 'ddd')
				})
			}
		}
	}
</script>

<style>
</style>